<?php
/**
 * Created by JetBrains PhpStorm.
 * User: power_yin
 * Date: 13-10-12
 * Time: 下午12:03
 * To change this template use File | Settings | File Templates.
 */
 function qq_status($qq){
     $url = 'http://wpa.qq.com/pa?p=2:'.$qq.':52';
     $Headers = get_headers($url, 1);
     if ($Headers['Location']=='http://pub.idqqimg.com/qconn/wpa/button/button_121.gif'){
         $Status = 1;  //QQ在线
     }elseif ($Headers['Location']=='http://pub.idqqimg.com/qconn/wpa/button/button_120.gif'){
         $Status = 2;  //QQ离线
     }else {
         $Status = 0;  //未知
     }
     return $Status;
 }

 $status_code = qq_status($_GET['qqNumber']);
 header("Content-type:text/html; Charset=UTF-8");
 if( $status_code == 1){
     exit(json_encode(['status' => true]));
 }else{
     exit(json_encode(['status' => false]));
 }
?>